export default function(state,action){
	switch(action.type){
		case "ADD_SS":  
		//console.log(state.history) 
		 //判断当前数据库中是否有此条数据,如果有则原路返回,没有插入
		 for(var i=0; i<state.history.length;i++){
		 	if(action.text ==state.history[i]){
		 		return state;
		 	}
		 }
		 //如果当前问空也原路返回
		 if(action.text ==""){
		 	return state;
		 }
		
		return {
		 	history : [...state.history,action.text]
				 }
		 
			break;
		//删除动作,返回空数组
		case "REM_SS":
		//console.log(state.history)
		return {
		 	history : []
				 }
		break;
			default : 
            return state;
            break;
	}
}